<?php
  // 引入公共的封装模块
  include './common.php';
  // 获取数据
  $res = getData("select id,name,photo,gender,birthday from userinfo");
  foreach ($res as $key=>$item) {
      $curr_year=date('Y', time());
      $timestamp=strtotime($item['birthday']);
      $birth_year=date('Y', $timestamp);
      $age=$curr_year-$birth_year;
      $res[$key]['age']=$age;
  }
  echo json_encode($res);
